﻿@using Pyramid.Models
@using Pyramid.Mvc.Html
@using Pyramid.Extentions
@model  IEnumerable<Staff>
@{
	var bag = (StaffListViewModel)ViewBag.Bag;
}

@using (Html.BeginForm("List", "Staff", FormMethod.Post, new {id = "pagerForm"}))
{
	<input type="hidden" name="pageNum" value="1" />
	<input type="hidden" name="numPerPage" value="${model.numPerPage}" />
}

<div class="pageHeader">
	@using (Html.BeginForm("List", "Staff", FormMethod.Post, new {onsubmit = "return navTabSearch(this);"}))
	{
		<div class="searchBar">
			<table class="searchContent">
				<tr>
					<td>工号：<input type="text" name="staffCode" rel="pagerForm" value="@bag.QueryModel.StaffCode" /></td>
					<td>员工姓名：<input type="text" name="keywords" rel="pagerForm" value="@bag.QueryModel.Keywords" /></td>
					<td>
						@Html.DropDownList("departmentId",bag.Departments,new {@class="combox", rel="pagerForm"})
					</td>
					<td>
						@Html.DropDownList("positionId",bag.StaffPositions,new {@class="combox", rel="pagerForm"})
					</td>
				</tr>
			</table>
		</div>
		<div class="subBar">
			<table>
				<tr>
					<td>
						入职日期从 
						<input type="text" name="entryDateFrom" class="date" readonly="readonly" rel="pagerForm" value="@Html.DateString(bag.QueryModel.EntryDateFrom)" /> 至 
						<input type="text" name="entryDateTo" class="date" readonly="readonly" rel="pagerForm"  value="@Html.DateString(bag.QueryModel.EntryDateTo)"/>
					</td>
					<td>&nbsp;&nbsp;</td>
					<td>
						<div class="buttonActive">
							<div class="buttonContent">
								<button type="submit">查询</button>
							</div>
						</div>
					</td>
				</tr>
			</table>
		</div>
	}
</div>
<div class="pageContent">
	<div class="panelBar">
		<ul class="toolBar">
			<li><a class="add" href="@Url.Action("Create")" target="dialog" mask="true" title="添加员工档案" width="810" height="480" resizable="false"><span>添加</span></a></li>
			<li><a class="edit" href="@Url.Action("Edit", new { id = "{id}" })" target="dialog" mask="true" title="编辑员工档案" width="810" height="480" resizable="false"><span>修改</span></a></li>
			<li><a class="delete" href="@Url.Action("Delete",new {id="{id}"})" target="ajaxTodo" title="确定要删除吗？"><span>删除</span></a></li>
		</ul>
	</div>
	<table class="table" width="100%" layouth="138">
		<thead>
			<tr>
				<th width="100">@Html.DisplayNameFor(m=>m.Code)</th>
				<th width="120">@Html.DisplayNameFor(m=>m.FullName)</th>
				<th width="80">@Html.DisplayNameFor(m=>m.Gender)</th>
				<th width="150">@Html.DisplayNameFor(m=>m.DepartmentId)</th>
				<th width="150">@Html.DisplayNameFor(m=>m.PositionId)</th>
				<th width="120">@Html.DisplayNameFor(m=>m.EntryDate)</th>
				<th width="80">@Html.DisplayNameFor(m=>m.Status)</th>
				<th width="80">@Html.DisplayNameFor(m=>m.Mobile)</th>
				<th>@Html.DisplayNameFor(m=>m.HomeAddress)</th>
			</tr>
		</thead>
		<tbody>
			@foreach (var s in Model)
			{
				<tr target="id" rel="@s.Id">
					<td>@s.Code</td>
					<td>@s.FullName</td>
					<td>@s.GenderEnum.ToDescription()</td>
					<td>@s.Department.Name</td>
					<td>@s.Position.Name</td>
					<td>@s.EntryDate.ToString("yyyy-MM-dd")</td>
					<td>@s.StatusEnum.ToDescription()</td>
					<td>@s.Mobile</td>
					<td>@s.HomeAddress</td>
				</tr>
			}
		</tbody>
	</table>
	<div class="panelBar">
		<div class="pages">
			<span>显示</span>
			<select class="combox" name="numPerPage" onchange="navTabPageBreak({numPerPage:this.value})">
				<option value="20">20</option>
				<option value="50">50</option>
				<option value="100">100</option>
				<option value="200">200</option>
			</select>
			<span>条，共 @bag.TotalCount 条</span>
		</div>
		<div class="pagination" targettype="navTab" totalcount="@bag.TotalCount" numperpage="@bag.PageSize" pagenumshown="10" currentpage="@bag.CurrentPageIndex"></div>
	</div>
</div>
